package core.molecules.organic;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import core.molecules.MoleculeBase;
import core.molecules.atoms.Atom;
import core.molecules.atoms.Atom.SpecialState;



/**
 * This is a class designed to help as a base for organic molecules/compounds. It adds a large amound of functionality
 * based on the fact that organic compounds are assumed to be composed of atoms.
 * @author Julian
 *
 */
public abstract class OrganicCompound extends MoleculeBase<Atom> {

	
	
	public OrganicCompound(int id) {
		super(id);
	}

	@Override
	public String toString() {
		return super.toString();
	}

	
//	public abstract boolean isComplete();
	
	/**
	 * Retrieves all atoms carrying the give SpecialState enum (found only in atoms)
	 */
	public List<Atom> getAtomsWithState(SpecialState ss) {
		ArrayList<Atom> specs = new ArrayList<Atom>();
		for (Atom a: this){
			if (a.hasState(ss))
				specs.add(a);
		}
		
		return specs;
	}
	
	/**
	 * Simply checks to see if this molecule carries any atoms with the specified state
	 * @param ss
	 * @return
	 */
	public boolean hasAtomsWithState(SpecialState ss) {
		for (Atom a: this){
			if (a.hasState(ss))
				return true;
		}
		
		return false;
	}
	
}
